package com.jzo2o.foundations.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.jzo2o.common.model.PageResult;
import com.jzo2o.foundations.mapper.ServeMapper;
import com.jzo2o.foundations.model.domain.Serve;

import com.jzo2o.foundations.model.dto.request.ServePageQueryReqDTO;
import com.jzo2o.foundations.model.dto.response.ServeResDTO;
import com.jzo2o.foundations.service.IServeService;
import com.jzo2o.mysql.utils.PageHelperUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Description IServeServiceImpl
 * @Author shejunlian
 * @Date 2024-08-19
 */
@Service
public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements IServeService {

    @Resource
    private ServeMapper serveMapper;

    /**
     * 分页查询区域服务
     * @param servePageQueryReqDTO 查询条件
     * @return  分页查询结果
     */
    @Override
    public PageResult<ServeResDTO> page(ServePageQueryReqDTO servePageQueryReqDTO) {

        PageResult<ServeResDTO> serveResDTOPageResult = PageHelperUtils
                .selectPage(servePageQueryReqDTO, () -> serveMapper.page(servePageQueryReqDTO.getRegionId()));

       return serveResDTOPageResult;
    }
}
